#lang racket/base
(provide
 (except-out
  (all-defined-out)
  define-structs))

(require
 (for-syntax
  racket/base
  racket/syntax
  syntax/stx)
 syntax/parse/define)

(define-simple-macro (define-structs
                       pre [common-arg ...]
                       (suf arg ...)
                       ...)
  #:with [pre+suf ...]
         (stx-map (λ (x) (format-id x "~a:~a" #'pre x))
                  #'[suf ...])
  (begin
    (struct pre [common-arg ...] #:prefab)
    (struct pre+suf pre [arg ...] #:prefab)
    ...))

(define-struct sp:def [pat body] #:prefab)

(define-structs sp:e []
  (var id)
  (datum dat)
  (primop name)
  (app fn args kargs)
  (λ args kargs body)
  (let bindings body))
